package com.learn.security.api.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author PC
 * 权限测试Controller
 */
@RestController("authController.v1")
@RequestMapping("/v1/auth")
public class AuthController {

    @Secured(value = {"admin"})
    @GetMapping("/admin")
    public String admin(){
        return "hello admin";
    }

    @Secured(value = {"role_admin"})
    @GetMapping("/role-admin")
    public String roleAdmin(){
        return "hello ROLE_admin";
    }

    @GetMapping("/pub")
    public String pub(){
        return "hello pub";
    }

}
